package com.evildog.workspace.system.application.convert;

import com.evildog.workspace.dependencies.mybatis.object.LinkIdDTO;
import com.evildog.workspace.system.application.bo.ComponentPermissionBO;
import com.evildog.workspace.system.application.bo.ComponentPermissionListBO;
import com.evildog.workspace.system.application.dto.ComponentPermissionDTO;
import com.evildog.workspace.system.application.dto.ComponentPermissionListDTO;
import com.evildog.workspace.system.application.entity.ComponentPermission;
import com.evildog.workspace.system.application.entity.ComponentPermissionListDO;
import com.evildog.workspace.system.application.model.ComponentPermissionListParam;
import com.evildog.workspace.system.application.model.ComponentPermissionParam;
import com.evildog.workspace.system.application.model.ComponentPermissionUpdateApiParam;
import com.evildog.workspace.system.application.vo.ComponentPermissionListVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface ComponentPermissionConvert {

    ComponentPermissionConvert INSTANCE = Mappers.getMapper(ComponentPermissionConvert.class);

    ComponentPermissionListDTO convert(ComponentPermissionListParam componentPermissionListParam);

    ComponentPermissionDTO convert(ComponentPermissionParam componentPermissionParam);

    @Mapping(target = "isDeleted", ignore = true)
    ComponentPermission convert(ComponentPermissionDTO componentPermissionDTO);

    ComponentPermissionBO convert(ComponentPermission componentPermission);

    List<ComponentPermissionListVO> convert(List<ComponentPermissionListBO> page);

    List<ComponentPermissionListBO> convertBOList(List<ComponentPermissionListDO> list);
    List<ComponentPermissionListBO> convertBOList2(List<ComponentPermission> list);

    @Mapping(target = "linkIds", source = "apiPermissions")
    LinkIdDTO convert(ComponentPermissionUpdateApiParam param);
}